{% extends "main.html" %}

{% block script %}
var fields = [	
	{key:"user", label:"User"},
	{key:"created", label:"created"},
	{key:"updated", label:"updated"},
	{key:"url", label:"url"},
	{key:"refreshed", label:"refreshed"}
];

var datasource = new YAHOO.util.DataSource(YAHOO.util.Dom.get("datatable"));
datasource.responseType = YAHOO.util.DataSource.TYPE_HTMLTABLE;
datasource.responseSchema = {fields: fields};

var datatable = new YAHOO.widget.DataTable("container",fields,datasource);

{% endblock %}

{% block content %}
<h3>Feed List</h3>

<div id="container">
	<table id="datatable">
		<thead>
			<tr>
				<th><a href="#">user</a></th>
				<th><a href="#">created</a></th>
				<th><a href="#">updated</a></th>
				<th><a href="#">url</a></th>
				<th><a href="#">refreshed</a></th>
			</tr>
		</thead>
		<tbody>
			{% for feed in feeds %}
			<tr>
				<td>{{feed.user.nickname}}</td>
				<td>{{feed.created}}</td>
				<td>{{feed.updated}}</td>
				<td>{{feed.url}}</td>
				<td>{{feed.refreshed}}</td>
			</tr>
			{% endfor %}
		</tbody>
	</table>
</div>

<form  method='post' action='/feeds'>
	<h3>Create a feed</h3>
	<ul>
	    {{ FeedForm.as_ul }}
	</ul>
	<input type='submit' value='create' />
</form>
{% endblock %}
